package com.xr.oa.announce;

import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.SqlDataset;
import com.bstek.dorado.common.*;
import com.xr.common.CommUtil;

/**
 * announce_dataset_announce_listListener
 */
public class announce_dataset_announce_listListener extends AbstractDatasetListener {
  public boolean beforeLoadData(Dataset dataset)
     throws Exception {
	  SqlDataset ds = (SqlDataset) dataset;
	  
	  String className = dataset.parameters().getString("className");
		String sql = "";
		 
		
		if(className != null && className.equals("announce_list_manage_dataset")) {
			   sql="select INFO_ANNOUNCE_ID,ANNOUNCE_TITLE,MSG_CLASS,SEND_DATE,OVERDUE_DATE from oa_info_announce where MSG_CLASS<>4 and is_delete is null and SEND_MAN="+CommUtil.getEmployeeId();
				  sql += CommUtil.setConditionSQL(ds);
				  ds.setSql(sql+" order by send_date desc");
				  return true;
		}

	    sql="select INFO_ANNOUNCE_ID,ANNOUNCE_TITLE,MSG_CLASS,SEND_DATE,OVERDUE_DATE from oa_info_announce where MSG_CLASS<>4 and is_delete is null and SEND_MAN="+CommUtil.getEmployeeId();
	  sql += CommUtil.setConditionSQL(ds);
	  ds.setSql(sql);
    return true;
  }

}
